package kr.saeildamil.androidstudty.ch08;

import android.app.Activity;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.widget.Toast;

public class AnonymousHandleEvent extends Activity {
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		View v = new View(this);
		v.setOnTouchListener(listener);
		setContentView(v);
	}
	
	View.OnTouchListener listener = new OnTouchListener() {
		public boolean onTouch(View v, MotionEvent event) {
			if (event.getAction()==MotionEvent.ACTION_DOWN){
				Toast.makeText(AnonymousHandleEvent.this, "Point " + event.getX() + ", " + event.getY() + " ACTION_DOWN", Toast.LENGTH_SHORT).show();
				return true;
			}else if (event.getAction()==MotionEvent.ACTION_UP){
				Toast.makeText(AnonymousHandleEvent.this, "ACTION_UP", Toast.LENGTH_SHORT).show();
				return true;
			}
			return false;
		}
	};
}
